package cron

import (
	"gfrest/common/util"

	"github.com/getsentry/sentry-go"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/os/gcron"
)

func init() {
	StartCronTask()
}

// StartCronTask StartCronTask
func StartCronTask() {
	// gcron.Add("* * * * * *", func() { glog.Println("Every second") })
	gcron.Add("*/30 * * * * *", func() {
		defer sentry.Recover()
		g.Log().Info("ls -lh", "/usr/lib/")

		a := 0
		_ = a / a
		g.Log().Info("ls -lh", "/usr/lib/")
		res, err := util.Command("ls", "-lh", "/usr/lib/")
		_, _ = res, err
		// glog.Info(res)
		// glog.Info(err)
	})
}
